<script setup>
import { ref, onUnmounted, nextTick } from "vue";
import { send } from "@/services/login";
import { onLoad } from "@dcloudio/uni-app";

import { useUserStore } from "@/stores/user.js";

import { shopBanner } from "@/services/index";
const id = ref(0);
const content = ref({});
const left = ref(0);
onLoad((option) => {
  id.value = option.id;
  getOpenapiPage();
  uni.getSystemInfo({
    success: function (res) {
      console.log(res);
      // console.log(res.windowHeight);
      // console.log((130 * res.windowHeight) / 768);
      left.value = (800 * res.windowHeight) / 768;

      // windowHeight
    },
  });
});

const getOpenapiPage = async () => {
  try {
    // let res = await openapiPage(postId.value);
    let res = await shopBanner({ id: id.value });

    if (res.code == 200) {
      // storeCenter.value = res.data.datas;
      content.value = res.data;
    } else {
    }

    console.log(res);
  } catch (e) {}
};
</script>
<template>
  <view class="bg">
    <swiper
      class="swiper"
      circular
      :autoplay="true"
      :interval="4000"
      :duration="500"
      :indicator-dots="false"
    >
      <swiper-item>
        <view
          class="swiper-item"
          v-for="(item, index) in content.banner"
          :key="index"
        >
          <view class="content-image">
            <view class="content-image-k">
              <image mode="heightFix" class="bg_image" :src="item" />
            </view> </view
        ></view>
      </swiper-item>
    </swiper>
    <!-- :style="'left:' + left + 'px;'" -->
    <view class="bc_flex">
      <view class="bc_image" v-if="content.shopQrcode">
        <image src="@/static/home/codeImage1.png" mode="widthFix" />
        <view class="code">
          <image :src="content.shopQrcode" />
        </view>
      </view>
      <view
        class="bc_image"
        v-if="content.wechatQrcode"
        style="margin-left: 50px"
      >
        <image src="@/static/home/codeImage2.png" mode="widthFix" />
        <view class="code">
          <image :src="content.wechatQrcode" />
        </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
@import "index.scss";
</style>
